#ifndef __PVMDRIVERINTERFACE_H__
#define __PVMDRIVERINTERFACE_H__

#include "pvm/pvmapi.h"

class IPVMVoice;
class IPVMDeviceBase;
class IPVMDeviceOutSimple;
class IPVMDeviceOutSimpleWaveSource;
class IPVMDeviceOut;

class IPVMDriverBase
{
protected:
	IPVMDriverBase() {};
public:
	virtual ~IPVMDriverBase() {};

	virtual pvm_bool Init() = 0;
	virtual void DriverClose() = 0;
	virtual pvm_bool IsInitialized() = 0;
	virtual pvm_uint32 GetDriverType() = 0;

	//optionVal - pointer to buffer that receives option value
	//optionSize - size of buffer, on output filled by size of data tha have been copied to optionVal
	virtual pvm_bool GetDriverOption(const pvm_char* optionName, void* optionVal, pvm_uint32* optionSize) = 0;
	//optionVal - pointer to buffer with option value
	//optionSize - size of buffer
	virtual pvm_bool SetDriverOption(const pvm_char* optionName, void* optionVal, pvm_uint32 optionSize) = 0;

	virtual void CloseDevice(IPVMDeviceBase* device) = 0;
	virtual void OnIdle() {}
};

class IPVMDriverOutBase : public IPVMDriverBase
{
protected:
	IPVMDriverOutBase(){};
public:
	virtual ~IPVMDriverOutBase(){};


	//return number of devices instaled in system
	virtual pvm_uint32 DevicesNum() = 0;
	//nDevice could be -1 for default device
	//set buffer to NULL to get name length (including termination zero)
	//maxLength - max buffer length including zero char
	//returns number of copied chars, -1 on error or 0 if buffer too small
	virtual pvm_int32 DeviceName(pvm_int32 nDevice, pvm_char* buffer, pvm_uint32 maxLength) = 0;

	virtual pvm_bool DeviceEnumModes(pvm_int32 nDeivce, TFormatEnumCallbackProc enumProc, void *param) = 0;
};

class IPVMDriverOutSimpleDevice : public IPVMDriverOutBase
{
protected:
	IPVMDriverOutSimpleDevice() {};
public:	
	virtual ~IPVMDriverOutSimpleDevice() {};

	virtual IPVMDeviceOutSimple* DeviceOpen(pvm_uint32 samplesPerSec, pvm_uint32 bitsPerSample, pvm_uint32 chanelsNum, pvm_int32 deviceNum, void *additionalInfo, pvm_uint32 infoSize, IPVMDeviceOutSimpleWaveSource *waveSource, pvm_bool deviceSuspended) = 0;
	virtual void OnIdle() {};
};

class IPVMDriverOut : public IPVMDriverOutBase
{
protected:
	IPVMDriverOut(){};
public:
	virtual ~IPVMDriverOut(){};
public:
	virtual pvm_uint32 DeviceHardwareChanels(pvm_int32 deviceNumber) = 0;
	virtual IPVMDeviceOut* DeviceOpen(pvm_uint32 maxVoices, pvm_uint32 samplesPerSec, pvm_uint32 bitsPerSample, pvm_uint32 chanelsNum, pvm_int32 deviceNum, void *additionalInfo, pvm_uint32 infoSize) = 0;
};
#endif

